<?php
defined('IN_IXDCW') or exit('Access Denied');
include tpl('header');
show_menu($menus);
?>
<form action="?">
    <div class="tt">车款搜索
	    当前位置 <?php if($arbid){echo "[{$brandInfo['name']}";}?>
	        <?php if($armid){echo ">{$manuInfo['name']}";}?>
	        <?php if($arcid){echo ">{$carInfo['name']}";}?>]
    </div>
    <input type="hidden" name="moduleid" value="<?php echo $moduleid;?>"/>
    <input type="hidden" name="action" value="<?php echo $action;?>"/>
    <table cellpadding="2" cellspacing="1" class="tb">
	    <tr>
		    <td>
			    <?php echo Post::autocatTree('year', AutoCategory::TYPE_YEAR, '年款', $year); ?>
			    <input type="hidden" name="arbid" value="<?php echo $arbid;?>">
			    <input type="hidden" name="arcid" value="<?php echo $arcid;?>">
			    <input type="hidden" name="armid" value="<?php echo $armid;?>">
		    </td>
	    </tr>
        <tr>
            <td>
                &nbsp;<?php echo $fields_select;?>&nbsp;
                <input type="text" size="30" name="kw" value="<?php echo $kw;?>" title="关键词"/>&nbsp;
				<?php echo $order_select;?>&nbsp;
                <input type="text" name="psize" value="<?php echo $pagesize;?>" size="2" class="t_c" title="条/页"/>
                <input type="submit" value="搜 索" class="btn"/>&nbsp;
                <input type="button" value="重 置" class="btn" onclick="window.location='?moduleid=<?php echo $moduleid;?>&file=<?php echo $file;?>&action=<?php echo $action;?>';"/>
            </td>
        </tr>
    </table>
</form>
<form method="post">
    <div class="tt"><?php echo $menus[$menuid][0];?></div>
    <table cellpadding="2" cellspacing="1" class="tb">
        <tr>
            <th width="25"><input type="checkbox" onclick="checkall(this.form);"/></th>
            <th width="25"> </th>
            <th>年款</th>
            <th>车型名称</th>
            <th width="50">价格</th>
            <th width="50">状态</th>
            <th width="50">显示</th>
            <th width="120">更新时间</th>
            <th width="50">操作</th>
        </tr>
		<?php foreach ($lists as $k => $v) { ?>
        <tr onmouseover="this.className='on';" onmouseout="this.className='';" align="center">
            <td><input type="checkbox" name="amids[]" value="<?php echo $v['amid'];?>"/></td>
            <td><?php
	            if ($v['modeltype']=='passenger'){
		            echo '<span style="color:#247E00">乘</span>';
	            } else if ($v['modeltype'] == 'commercial'){
		            echo '<span style="color:#2960FB">商</span>';
	            } else if ($v['modeltype'] == 'rv'){
		            echo '<span style="color:#FFA200">房</span>';
	            }
	            ?></td>
            <td><?php echo AutoCategory::getCacheItem(AutoCategory::TYPE_YEAR, $v['year']);?></td>
            <td style="text-align: left"><?php echo $v['name'];?></td>
            <td><input type="text" size="10" value="<?php echo $v['price'];?>" onchange="updateModelPrice(<?php echo $v['amid'];?>, this.value)"></td>
            <td>
	            <?php if ($v['issale']) {
		            echo '<span style="color:#08A254">在售</span>';
	            } else{
		            echo '<span style="color:#A31F1F">停售</span>';
	            }?>
            </td>
	        <td>
		        <?php if ($v['status']==3) {
			        echo '<span style="color:#08A254">显示</span>';
		        } else{
			        echo '<span style="color:#A31F1F">隐藏</span>';
		        }?>
	        </td>
            <td class="px11"><?php echo date('m-d',$v['edittime']);?></td>
            <td>
                <a href="?moduleid=<?php echo $moduleid;?>&action=edit&modelType=<?php echo $v['modeltype'] ?>&amid=<?php echo $v['amid'];?>"><img src="admin/image/edit.png" width="16" height="16" title="修改" alt=""/></a>&nbsp;
                <a href="?moduleid=<?php echo $moduleid;?>&action=delete&modelType=<?php echo $v['modeltype'] ?>&amid=<?php echo $v['amid'];?>" onclick="return _delete();"><img src="admin/image/delete.png" width="16" height="16" title="删除" alt=""/></a>
            </td>
        </tr>
		<?php }?>
    </table>
	<div class="btns">
		<?php echo Post::autoComboCar('arbid','arcid', 0, 0, 1, 1); ?>&nbsp;
		<input type="submit" value=" 更改分类 " class="btn" onclick="this.form.action='?moduleid=<?php echo $moduleid;?>&modelType=<?php echo $v['modeltype'] ?>&action=updateCategory';"/>
	</div>
</form>
<div class="pages">
	<?php $do->getPn()->render();?>
	<input type="text" size="4" id="goPage" value="<?php echo $do->getPn()->getPage(); ?>" class="input"> <input type="button" onclick="go('page', $('#goPage').val())" value="跳转" class="btn">
</div>
<br/>
<script type="text/javascript">
	Menuon(<?php echo $menuid;?>);
	function updateModelName(amid, name) {
		$.post('?moduleid=<?php echo $moduleid;?>&action=updateModelname', {uAmid:amid,uModelName:name}, function(data){
			if (data ) {
				showmsg(data, 2000);
			}
		})
	}
	function updateModelPrice(amid, price) {
		$.post('?moduleid=<?php echo $moduleid;?>&action=updateModelPrice', {uAmid:amid,uModelPrice:price}, function(data){
			if (data) {
				showmsg(data, 2000);
			}
		})
	}
</script>
<?php include tpl('footer'); ?>